QT += core gui xml webkit network

include(qtsingleapplication/src/qtsingleapplication.pri)

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = fundamental
TEMPLATE = app

win32 {
	INCLUDEPATH += "../fundamental/win-deps-x86/include/poppler/qt4"
	DEFINES += HAS_SLIGHT_HINTING
	LIBS += "../fundamental/win-deps-x86/bin/libpoppler-qt4.dll"
} else {
	exists( /usr/local/include/poppler/qt4 ) {
		INCLUDEPATH += /usr/local/include/poppler/qt4
		QMAKE_LIBDIR += /usr/local/lib
		QMAKE_RPATHDIR += /usr/local/lib
		DEFINES += HAS_SLIGHT_HINTING
	} else {
		system(pkg-config --atleast-version=0.8 poppler-qt4) : {
		} else {
			error("Your poppler-qt4 is too old! You need at least version 0.8, recommended is >= 0.18.")
		}
		system(pkg-config --atleast-version=0.18 poppler-qt4) : DEFINES += HAS_SLIGHT_HINTING
		CONFIG += link_pkgconfig
		PKGCONFIG += poppler-qt4
	}
	LIBS += -lpoppler-qt4
	target.path = /usr/bin
	INSTALLS += target
	QMAKE_CXXFLAGS += -std=c++11 -Wno-unused-local-typedefs -gdwarf-2
}

win32 {
	RC_FILE = fundamental.rc
}

DEFINES += VERSION=0.27

SOURCES += main.cpp\
    mainwindow.cpp \
    pdfviewer.cpp \
    library.cpp \
    pdftool.cpp \
    qswiftprogressdialog.cpp \
    chronometer.cpp \
    customwebpage.cpp \
    browser.cpp \
    ratingwidget.cpp \
    naturaltreewidgetitem.cpp \
    qcoloredtabwidget.cpp \
    downloadwidget.cpp \
    notewidget.cpp \
    annotation.cpp \
    reportwidget.cpp \
    mytextedit.cpp \
    markedscrollbar.cpp \
    rendercachekey.cpp

HEADERS  += mainwindow.h \
    pdfviewer.h \
    library.h \
    pdftool.h \
    qswiftprogressdialog.h \
    chronometer.h \
    customwebpage.h \
    browser.h \
    ratingwidget.h \
    naturaltreewidgetitem.h \
    proxystyle.h \
    qcoloredtabwidget.h \
    downloadwidget.h \
    notewidget.h \
    annotation.h \
    reportwidget.h \
    mytextedit.h \
    markedscrollbar.h \
    rendercachekey.h

FORMS    += mainwindow.ui \
    pdfviewer.ui \
    qswiftprogressdialog.ui \
    browser.ui \
    downloadwidget.ui \
    notewidget.ui \
    reportwidget.ui

RESOURCES += \
    icons.qrc

OTHER_FILES += \
    merge-pdfs.py \
    icons/fundamental.png \
    fundamental.desktop \
    PyPDF2/setup.py \
    PyPDF2/README \
    PyPDF2/MANIFEST.in \
    PyPDF2/LICENSE \
    PyPDF2/CHANGELOG \
    PyPDF2/PyPDF2/xmp.py \
    PyPDF2/PyPDF2/utils.py \
    PyPDF2/PyPDF2/pdf.py \
    PyPDF2/PyPDF2/merger.py \
    PyPDF2/PyPDF2/__init__.py \
    PyPDF2/PyPDF2/generic.py \
    PyPDF2/PyPDF2/filters.py

unix {
	icon.path = /usr/share/icons
	icon.files = icons/fundamental.png
	INSTALLS += icon

	shortcut.path = /usr/share/applications
	shortcut.files = Fundamental.desktop
	INSTALLS += shortcut

	mergepdfs.path = /usr/bin
	mergepdfs.files = merge-pdfs.py
	INSTALLS += mergepdfs

	pypdf.path = /usr/bin/PyPDF2
	pypdf.files = PyPDF2/PyPDF2/__init__.py \
				  PyPDF2/PyPDF2/filters.py \
				  PyPDF2/PyPDF2/generic.py \
				  PyPDF2/PyPDF2/merger.py \
				  PyPDF2/PyPDF2/pdf.py \
				  PyPDF2/PyPDF2/utils.py \
				  PyPDF2/PyPDF2/xmp.py
	INSTALLS += pypdf
}
